package com.oj.api.domain.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.oj.api.domain.UserExeResult;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Description
 * @Author bin
 * @Date 2025/6/30
 */
@Data
public class UserQuestionResultVO {

    private Integer pass; // 0通过 1不通过

    private String exeMessage; // 异常信息

    private List<UserExeResult> userExeResultList;

    @JsonIgnore
    private Integer score;

    public static UserQuestionResultVO success(Integer pass, String exeMessage, List<UserExeResult> userExeResultList, Integer score) {
        return assemble(pass, exeMessage, userExeResultList, score);
    }

    public static UserQuestionResultVO fail(Integer pass, String exeMessage, List<UserExeResult> userExeResultList, Integer score) {
        return assemble(pass, exeMessage, userExeResultList, score);
    }

    private static UserQuestionResultVO assemble(Integer pass, String exeMessage, List<UserExeResult> userExeResultList, Integer score) {
        UserQuestionResultVO userQuestionResultVO = new UserQuestionResultVO();
        userQuestionResultVO.setPass(pass);
        userQuestionResultVO.setExeMessage(exeMessage);
        userQuestionResultVO.setUserExeResultList(userExeResultList);
        userQuestionResultVO.setScore(score);
        return userQuestionResultVO;
    }
}
